﻿namespace yab

open System
open System.Reflection

module TypeHelper =

    let is<'t> t = t = typeof<'t>
    let isNullable <'t when 't : struct and 't : (new : unit ->  't) and 't :> ValueType> t = t = typeof<'t> or t = typeof<Nullable<'t>>
    
    let private get position anArray = Array.get anArray position
    let getShortestConstructor (t:Type) = t.GetConstructors() |> Array.sortBy (fun c -> c.GetParameters() |> Array.length) |> get 0